import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/Manage.vue'

Vue.use(VueRouter)

const routes = [
    {
        path: '/',
        name: 'Manage',
        component: () => import("../views/Manage.vue"),
        redirect: "/home",
        children: [
            {
                path: 'home',
                name: 'Home',
                component: () => import("../components/Home.vue"),
            },
            {
                path: 'user',
                name: 'User',
                component: () => import("../components/User.vue"),
            },
            {
                path: 'person',
                name: 'Person',
                component: () => import("../views/Person.vue"),
            },
            {
                path: 'im',
                name: 'Im',
                component: () => import("@/views/Im"),
            },
            {
                path: 'robot',
                name: '机器人',
                component: () => import("@/views/Robot.vue"),
            },
            {
                path: 'role',
                name: '角色管理',
                component: () => import("../views/Role.vue"),
            },
            {
                path: 'menu',
                name: '菜单管理',
                component: () => import("../views/Menu.vue"),
            },
            {
              path: 'video',
              name: '音频通话',
              component: () => import("../views/VideoChat.vue"),
          },
        ]
    },
    {
        path: '/login',
        name: 'Login',
        component: () => import('../views/Login.vue')
    },
    {
        path: '/register',
        name: 'Register',
        component: () => import('../views/Register.vue')
    },

    {
        path: '/about',
        name: 'about',
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
    }
]

const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes
})

export default router
